package com.etc.service.impl;

import com.etc.dao.OrderSkuMapper;
import com.etc.entity.OrderSku;
import com.etc.service.OrderSkuService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class OrderSkuServiceImpl implements OrderSkuService {
    @Autowired
    OrderSkuMapper dao;
    @Override
    public boolean getdeleteByPrimaryKey(String id) {
        int n = dao.deleteByPrimaryKey(id);
        return n>0;
    }

    @Override
    public boolean getinsert(List<OrderSku> record) {
        int n = dao.insert(record);
        return n>0;
    }

    @Override
    public PageInfo<OrderSku> getselectByPrimaryKey(int num) {
        PageHelper.startPage(num,2);
        List<OrderSku> list = dao.selectByPrimaryKey();
        PageInfo<OrderSku> info = new PageInfo<OrderSku>(list);
        return info;
    }

    @Override
    public PageInfo<OrderSku> getselectByStasus(String spc,int num) {
        PageHelper.startPage(num,2);
        List<OrderSku> list = dao.selectByStasus(spc);
        PageInfo<OrderSku> info = new PageInfo<OrderSku>(list);
        return info;
    }

    @Override
    public boolean upBystaus(String spc, String n) {
        int i = dao.upBystaus(spc, n);
        return i>0;
    }

    @Override
    public List<OrderSku> getselectByall() {
        return dao.selectByPrimaryKey();
    }

    @Override
    public OrderSku getselectById(String id) {
        OrderSku orderSku = dao.selectByid(id);
        return orderSku;
    }
}
